﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using MediaTool.Model.Picture;
using System.Collections.Generic;

namespace MediaToolTest.Model.Picture
{
    [TestClass]
    public class JPGImageTest
    {
        #region Constructor tests
        
        ////[TestMethod]
        ////public void ConstructorTestImageObject()
        ////{
        ////    System.Drawing.Image picture = System.Drawing.Image.FromFile(@"D:\Pictures\RenamingTest\P1010008.JPG");
        ////    JPGImage target = new JPGImage(picture);
        ////    DateTime expected = new DateTime(2013, 7, 8, 15, 54, 42);

        ////    Assert.AreEqual(expected, target.DateTaken);
        ////}

        [TestMethod]
        public void ConstructorTestPath()
        {
            JPGImage target = new JPGImage(@"D:\Pictures\RenamingTest\P1010008.JPG");
            DateTime expected = new DateTime(2013, 7, 8, 15, 54, 42);

            Assert.AreEqual(expected, target.DateTaken);
        } 
        
        #endregion

        #region Sorting tests

        [TestMethod]
        public void SortTest()
        {
            string picture0 = @"D:\Pictures\RenamingTest\P1010025.JPG";
            string picture1 = @"D:\Pictures\RenamingTest\P1010013.JPG";
            string picture2 = @"D:\Pictures\RenamingTest\P1010009.JPG";

            List<JPGImage> pictures = new List<JPGImage>()
            {
                new JPGImage(picture0),
                new JPGImage(picture1),
                new JPGImage(picture2)
            };

            pictures.Sort();

            Assert.IsTrue(pictures[0].DateTaken < pictures[1].DateTaken);
        }

        #endregion

        #region eadGeoTags tests

        [TestMethod]
        public void ReadGeoTagsTestSuccessfull()
        {
            string pic = @"E:\Pictures\GeoTestBilder\WP_000238.jpg";

            JPGImage target = new JPGImage(pic);
            target.ReadGeoTags();
        }

        #endregion
    }
}
